<?php

/*

  Action – Duration	$5

  Now and at the start of your next turn: +2 Cards; +1 Buy.

 */

class Wharf extends Card implements iAction, iKingdom, iDuration, iSeaside {

    public function __construct() {
        parent::__construct("Wharf", 5);
        $this->duration = 1;
        $this->undoPlay = false;
        $this->undoBuy = true;
    }

    public function getDescription() {
        return array(
            "Now and at the start of your next turn: +2 Cards; +1 Buy.");
    }
    
        public function getDisplayName($quantity = 1) {
        if ($quantity == 1) {
            return "Wharf";
        }
        return $quantity." Wharves";
    }
    
    public function play(Game $game, $isRealCard) {
        $drawed_cards = $game->drawCards(2);
        $game->addBuys(1);
         ScreenDisplay::addScreenMessage($game, true, "get +1 buy  and draw " . nicePrint($drawed_cards), "gets +1 buy and draws " . sizeof($drawed_cards) . " cards");

        $game->pushCardToDurationAffects($this, 1, $isRealCard);
		$game->cardActionFinished();
        return true;
    }

    public function cleanup(Game $game) {
        $game->moveCardFromPileToPile($this, PlayArea, DurationPileCards);
    }

    public function startTurn(Game $game, $quantity) {
        $drawed_cards = $game->drawCards(2);
        $game->addBuys(1);
         ScreenDisplay::addScreenMessage($game, true, "activate ".  nicePrint($this)." and get +1 buy  and draw " . nicePrint($drawed_cards), "activates ".  nicePrint($this)." and get +1 buy and draws " . sizeof($drawed_cards) . " cards");
        if ($quantity > 0)
            return RETURN_DURATION_TO_DISCARD;
        else
            return DELETE_VIRTUAL_DURATION_CARD;
    }

}

?>